//
//  SelectRegistrationStatusViewController.m
//  ppkc2016
//
//  Created by 拼凑的断音 on 16/3/2.
//  Copyright © 2016年 拼凑的断音. All rights reserved.
//

#import "SelectRegistrationStatusViewController.h"
#import "XXTool.h"

#import "VistorLoginViewController.h"
#import "ExhibitorLoginViewController.h"
#import "MainViewController.h"

@interface SelectRegistrationStatusViewController ()

@property (nonatomic)  UIImageView* backContentImg;
@property (nonatomic, strong) UIImageView *logoImg;
@property (nonatomic, strong) UIImageView *centerImg;
@property (nonatomic, strong) UIImageView *labelImg;

@property (nonatomic)  DKButton* exhibitorRegister;

@property (nonatomic)  DKButton* vistorRegister;

@end

@implementation SelectRegistrationStatusViewController

#pragma mark UI
-(UIImageView *)backContentImg
{
    if (_backContentImg == nil)
    {
        _backContentImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"launchBG.jpg"]];
        _backContentImg.contentMode = UIViewContentModeScaleAspectFill;
        _backContentImg.userInteractionEnabled = YES;
        [self.view addSubview:_backContentImg];
    }
    return _backContentImg;
}

-(UIImageView *)logoImg
{
    if (_logoImg == nil)
    {
        _logoImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"launchlogo"]];
        _logoImg.contentMode = UIViewContentModeScaleAspectFit;
        [self.backContentImg addSubview:_logoImg];
    }
    return _logoImg;
}

-(UIImageView *)centerImg
{
    if (_centerImg == nil)
    {
        _centerImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"launchCenter"]];
        _centerImg.contentMode = UIViewContentModeScaleAspectFit;
        [self.backContentImg addSubview:_centerImg];
    }
    return _centerImg;
}

-(UIImageView *)labelImg
{
    if (_labelImg == nil)
    {
        _labelImg = [UIImageView new];
        if([XXTool didCurrentLanguageChinese])
        {
            _labelImg.image = [UIImage imageNamed:@"launchC"];
        }
        else
        {
            _labelImg.image = [UIImage imageNamed:@"launchE"];
        }
        [self.backContentImg addSubview:_labelImg];
    }
    return _labelImg;
}

-(DKButton*)exhibitorRegister
{
    if (_exhibitorRegister==nil)
    {
        _exhibitorRegister = [[DKButton alloc] init];
        _exhibitorRegister.image = [UIImage imageNamed:@"我是展商按钮"];
        [_exhibitorRegister setColor:[UIColor clearColor] ForState:DKButtonStateNormal];
        _exhibitorRegister.imageRenderingMode = DKButtonRenderingModeAlwaysOriginal;
        [_exhibitorRegister addTarget:self Select:@selector(clickExhibitorRegister) ForEvent:DKButtonEventPressedEnd];
        [self.backContentImg addSubview:_exhibitorRegister];
    }
    return _exhibitorRegister;
}

-(DKButton*)vistorRegister
{
    if (_vistorRegister==nil)
    {
        _vistorRegister = [[DKButton alloc] init];
        _vistorRegister.image = [UIImage imageNamed:@"我是观众按钮"];
        _vistorRegister.imageRenderingMode = DKButtonRenderingModeAlwaysOriginal;
        [_vistorRegister setColor:[UIColor clearColor] ForState:DKButtonStateNormal];
        [_vistorRegister addTarget:self Select:@selector(clickVistorRegister) ForEvent:DKButtonEventPressedEnd];
        [self.backContentImg addSubview:_vistorRegister];
    }
    return _vistorRegister;
}

#pragma mark sub

-(void)initParameter
{

}

-(void)initUI
{
    
}

-(void)refreshLayout:(CGRect)frame
{
    self.backContentImg.frame = frame;
    self.logoImg.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width-[UIScreen mainScreen].bounds.size.width*560/750)/2
                            , [UIScreen mainScreen].bounds.size.height*290/1334
                            , [UIScreen mainScreen].bounds.size.width*560/750
                            , [UIScreen mainScreen].bounds.size.width/750*138);
    self.centerImg.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width-[UIScreen mainScreen].bounds.size.width*34/750)/2
                              , [UIScreen mainScreen].bounds.size.height*577/1334
                              , [UIScreen mainScreen].bounds.size.width*34/750
                              , [UIScreen mainScreen].bounds.size.width/750*26);
    if([XXTool didCurrentLanguageChinese])
    {
        self.labelImg.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width-[UIScreen mainScreen].bounds.size.width*320/750)/2, [UIScreen mainScreen].bounds.size.height*675/1334
                            , [UIScreen mainScreen].bounds.size.width*320/750
                            , [UIScreen mainScreen].bounds.size.width/750*89);
    }
    else
    {
        self.labelImg.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width-[UIScreen mainScreen].bounds.size.width*610/750)/2, [UIScreen mainScreen].bounds.size.height*675/1334
                            , [UIScreen mainScreen].bounds.size.width*610/750
                            , [UIScreen mainScreen].bounds.size.width/750*88);
    }
    
    self.vistorRegister.frame = CGRectMake((frame.size.width-[XXTool getWidthWithScreenWidth:542])/2
                                       , [XXTool getHeightWithScreenHeight:860]
                                       , [XXTool getWidthWithScreenWidth:542]
                                       , [XXTool getHeightWithScreenHeight:118]);
    self.vistorRegister.imageSize = self.vistorRegister.frame.size;
    
    self.exhibitorRegister.frame = CGRectMake(self.vistorRegister.frame.origin.x
                                          , self.vistorRegister.frame.origin.y+self.vistorRegister.frame.size.height+[XXTool getHeightWithScreenHeight:54]
                                          , self.vistorRegister.frame.size.width
                                          , self.vistorRegister.frame.size.height);
    self.exhibitorRegister.imageSize = self.exhibitorRegister.frame.size;
    
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = YES;
}

-(void)clickVistorRegister
{
    VistorLoginViewController *vc = [[VistorLoginViewController alloc] init];
    vc.isNeedGoIntro = self.isNeedGoIntro;
    [self.navigationController pushViewController:vc animated:YES];
}

-(void)clickExhibitorRegister
{
    ExhibitorLoginViewController *vc = [[ExhibitorLoginViewController alloc] init];
    vc.isNeedGoIntro = self.isNeedGoIntro;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
